﻿using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Dryricenet
{
    public partial class ph_Home : System.Web.UI.Page
    {
        public string tx = "";
        public string user = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Name"] == null)
            {
                //登录状态为空
                Response.Write("<script>javascript:alert('对不起,您还没有登录!');history.back();</script>");
                Response.End();
            }
            else if(!IsPostBack)
            {
                string name = Session["Name"].ToString();
                DataTable dt = userBLL.selectNameBll(name);
                DataRow dr = dt.Rows[0];//第一条数据
                int id= Convert.ToInt32(dr["UserID"]);
                int userid =Convert.ToInt32(dr["UserTypeID"]);
                if (userid == 2&&id==1)
                {
                    user = "超级管理员";
                }else if (userid == 2)
                {
                    user = "管理员";
                }
                else {
                    user = "用户";
                }
                if (dr["Image"].ToString() == "")
                {
                    tx = "img/profile_small.jpg";
                }
                else
                {
                    tx = dr["Image"].ToString();
                }
            }
        }
    }
}